package com.dynabook.ebs.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dynabook.ebs.common.BaseResponse;
import com.dynabook.ebs.common.ResultUtils;
import com.dynabook.ebs.model.entity.DbhItemMstV;
import com.dynabook.ebs.model.vo.PcmStockTransferDesignIfVO;
import com.dynabook.ebs.service.DbhItemMstVService;
import com.dynabook.ebs.service.PcmStockTransferDesignIfService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;


@RestController
public class EBSController {

    @Resource
    private DbhItemMstVService dbhItemMstVService;

    @Resource
    private PcmStockTransferDesignIfService pcmStockTransferDesignIfService;


    @GetMapping("test")
    public BaseResponse<DbhItemMstV> getMethodName() {
        QueryWrapper<DbhItemMstV> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("PN","WZ0043P01");

        DbhItemMstV result = dbhItemMstVService.getBaseMapper().selectOne(queryWrapper);
        return ResultUtils.success(result);
    }
    @GetMapping("/getEBSData")
    public BaseResponse<List<PcmStockTransferDesignIfVO>> getEBSData() {
         List<PcmStockTransferDesignIfVO> result= pcmStockTransferDesignIfService.getEBSData("0");
        return ResultUtils.success(result);
    }

    @PostMapping("/updateFlag")
    public BaseResponse<String> updateFlag(@NotNull  @RequestBody List<Long> ids) {
        Boolean result= pcmStockTransferDesignIfService.updateFlag(ids);
        return ResultUtils.success(result==true?"更新成功":"更新失败");
    }
    
    

}
